<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/axios.min.js"></script>
</head>
<body>
    <input type="text" id="user">
    <input type="text" id="pwd">
    <input type="button" value="注册" id="btn">
    <script>
        /*
          接口地址：http://jx.xuzhixiang.top/ap/api/reg.php
            接口请求方式：get
            接口参数：
                username用户名
                password密码
        */
        btn.onclick=function(){
            var username=user.value;
            var password=pwd.value;
             var regAPI = "http://jx.xuzhixiang.top/ap/api/reg.php";
             axios.get(regAPI,{params:{username,password}}).then(r=>{
                 if (r.data.code==0) {
                     alert(r.data.msg);
                 }else{
                     alert(r.data.msg);
                     location.href="login.html";
                 }
             })
        }
    </script>
</body>
</html>